//route 类似于 前端控制器
const express = require('express'); //Node.js web application framework
const foodItem = require('../../app/controllers/foodItem.server.controller.js');

module.exports = (app) => { //用于返回一些全局共享的常量或者变量

    const foodItemRouter = express.Router();
    foodItemRouter.route('/name/:name').get(foodItem.getFoodItemByName);
    foodItemRouter.route("/producer/:producer").get(foodItem.getFoodItemByProducer);
    foodItemRouter.route("/foodItem").post(foodItem.addFoodItem);
    foodItemRouter.route("/foodItem/itemId/:itemId").delete(foodItem.delFoodItem);
    foodItemRouter.route("/foodItems").get(foodItem.getFoodItems);
    foodItemRouter.route("/foodItem/name/producer").post(foodItem.getFoodItemByNameAndProducer);
    app.use('/foodStore', foodItemRouter);


};